﻿
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
#include "ace.DeviceObject.h"
#include "ace.Graphics.h"
#include "ace.Graphics_Imp.h"

//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
namespace ace {
	//----------------------------------------------------------------------------------
	//
	//----------------------------------------------------------------------------------
	DeviceObject::DeviceObject(Graphics* graphics)
		: m_graphics(graphics)
	{
		assert(m_graphics != nullptr);
		SafeAddRef(m_graphics);
		((Graphics_Imp*) graphics)->AddDeviceObject(this);
	}

	//----------------------------------------------------------------------------------
	//
	//----------------------------------------------------------------------------------
	DeviceObject::~DeviceObject()
	{
		((Graphics_Imp*)GetGraphics())->RemoveDeviceObject(this);
		SafeRelease(m_graphics);
	}

	//----------------------------------------------------------------------------------
	//
	//----------------------------------------------------------------------------------

}